package controller.listeners.manualCode;


import model.ManualCodeModel;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

import business.database.filtersemantic.CorpsFilterEnum;

import view.ManualCodeView;

public class PrevSelectionListener extends SelectionAdapter {

	private ManualCodeModel _model;
	private ManualCodeView _view;
	
	public PrevSelectionListener(ManualCodeView view, ManualCodeModel model) {
		this._model = model;
		this._view = view;
	}
	
	@Override
	public void widgetSelected(SelectionEvent event) {
		
		int minid = _model.getMinIdCodeCorp();
	 	int maxid = _model.getMaxIdCodeCorp();
		//Limpio centros, corps, etc
	 	 _model.reset();
	 	 
		 _view.resetFilter();//setCorpFilter("");
		 CorpsFilterEnum filterEnum = _view.getFilterCombo();
	 	 _model.setCorpFilter("false","","","","","","","","","","",filterEnum,minid,maxid);
	 	 
	 	 
	 	 _model.set_custom_corp("");
	 	
	 	 _view.setCachePreCodeCorps(_model.get_cache_precodecorps());
	 	 _view.setCandidateCenters(_model.getCandidateCenters(),_view.getSelected_cache_code_corp());
		
	}
}
